package com.example.basic.web.controller.newly;

import com.example.basic.core.result.Result;
import com.example.basic.core.result.ResultGenerator;
import com.example.basic.web.request.IndexRequest;
import com.example.basic.web.response.IndexDeviceResponse;
import com.example.basic.web.response.IndexFireResponse;
import com.example.basic.web.response.IndexResponse;
import com.example.basic.web.response.IndexTaskResponse;
import com.example.basic.web.service.newly.ISysIndexService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import java.util.List;

@RestController
@RequestMapping("/api/v1/byg/index")
public class SysIndexController {

    @Autowired
    private ISysIndexService sysIndexService;


    /**
     * 火化统计
     *
     * @param request
     * @return
     */
    @GetMapping("/fireChart")
    public Result<IndexFireResponse> fireChart(IndexRequest request) {
        return ResultGenerator.genSuccessResult(sysIndexService.fire(request));
    }


    /**
     * 任务统计
     * @return
     */
    @GetMapping("/task")
    public Result<List<IndexTaskResponse>> task(){
        return ResultGenerator.genSuccessResult(sysIndexService.task());
    }

    /**
     * 设备统计
     * @return
     */
    @GetMapping("/device")
    public Result<IndexResponse> device(){
        return ResultGenerator.genSuccessResult(sysIndexService.device());
    }



    /**
     * 设备分类
     * @return IndexDeviceResponse
     */
    @GetMapping("/deviceClassify")
    public Result<List<IndexDeviceResponse>> deviceClassify(){
        return ResultGenerator.genSuccessResult(sysIndexService.deviceClassify());
    }

}
